import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class InputStreamTest {
    public static void main(String[] args) throws IOException {

       // read1();
        System.out.println("======");
        read2();


    }
    public static void read1() throws IOException {
        //TODO 一次读取一个字节
        FileInputStream ist = new FileInputStream("D:/ceishi2/file01.txt");
        int a ;
        while ((a=ist.read())!=-1){
            System.out.println((char)a);
        }
        ist.close();




    }
    public static void read2() throws IOException {
        //TODO 一次读取多个字节
        FileInputStream ist = new FileInputStream("D:/ceishi2/file01.txt");
        byte [] bytes = new byte[3];
        int a;
        while ((a=ist.read(bytes))!=-1){
            System.out.println(new String(bytes,0,a));
        }
        ist.close();

    }

}
